package com.totoro.controller;

import lombok.SneakyThrows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.util.UUID;

/**
 * @author TOTORO
 * @date 2021/7/7 14:08
 * 多图上传统一路径
 */
@Controller
public class ImgsUploadController {

    @SneakyThrows
    @ResponseBody
    @RequestMapping(value = "uploadFiles", method = RequestMethod.POST)
    public String uploadFile(@RequestParam("images") MultipartFile[] files, HttpServletRequest request, HttpSession session) {
        // 将文件保存到session
        session.setAttribute("files", files);
        //跳转视图
        return "ok";
    }


}
